package com.syyo.gulimall.admin.controller;

import com.syyo.gulimall.admin.domain.FileUpload;
import com.syyo.gulimall.admin.domain.ResultVo;
import com.syyo.gulimall.admin.service.FileService;

import com.syyo.gulimall.admin.utils.ResultUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Auther: wangzhong
 * @Date: 2020/8/18 10:17
 * @Description:
 */
@Api(tags = "系统：文件模块")
@RestController
@RequestMapping("/file")
public class FileController {

    @Autowired
    private FileService fileService;

    /**
     * 上传
     *
     * @param file
     */
    @ApiOperation("文件上传")
    @PostMapping("/upload")
    public ResultVo<FileUpload> upload(MultipartFile file) {
        return ResultUtils.ok(fileService.uploadFile(file));
    }

}
